// pages/update_bind_tea/update_bind_detail_tea/update_bind_detail_tea.js
const baseURL = 'http://100.2.178.56:8080'
Page({

    /**
     * 页面的初始数据
     */
    data: {
        updateBind: null,
        grade_academy: null
    },

    pass_check: function () {

        var that=this
        wx.showModal({
            title: '提示',
            content: '确定通过吗！',
            success(res) {
                if (res.confirm) {

                    wx.request({
                        url: baseURL+'/teacher/pass_check',
                        method: "GET",
                        data: {
                            "use_id": that.data.updateBind.user.id
                        },
                        header: {
                            "Authorization": getApp().token
                        },
                        success: function (res) {

                            if (res.data.code == 0) {
                                wx.showToast({
                                    title: "审核完成",
                                    duration: 2000
                                })
                                setTimeout(function () {
                                    wx.navigateBack({
                                      
                                    })
                                  }, 1500)
                               
                            } else {
                                wx.showToast({
                                    title: res.data.message,
                                    duration: 2000
                                })
                            }

                        }
                    })


                } else if (res.cancel) {}
            }
        })
    },
    deny_check: function () {
        var that=this
        wx.showModal({
            title: '提示',
            content: '确定否决吗！',
            success(res) {
                if (res.confirm) {

                    wx.request({
                        url: baseURL+'/teacher/deny_check',
                        method: "GET",
                        data: {
                            "use_id": that.data.updateBind.user.id
                        },
                        header: {
                            "Authorization": getApp().token
                        },
                        success: function (res) {

                            if (res.data.code == 0) {
                                wx.showToast({
                                    title: "审核完成",
                                    duration: 2000
                                })
                                wx.navigateTo({
                                    url: '/pages/update_bind_tea/update_bind_tea',
                                })
                            } else {
                                wx.showToast({
                                    title: res.data.message,
                                    duration: 2000
                                })
                            }

                        }
                    })


                } else if (res.cancel) {}
            }
        })

    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        var that = this
        var obj = JSON.parse(options.updateBind)
        this.setData({
            updateBind: obj
        })
        wx.request({
            url: baseURL+'/teacher/get_update_bind_grade_academy',
            method: "GET",
            data: {
                "before_graId": this.data.updateBind.before_Student.graId,
                "after_graId": this.data.updateBind.after_student.graId,
            },
            header: {
                "Authorization": getApp().token
            },
            success: function (res) {
                if (res.data.code == 0) {
                    that.setData({
                        grade_academy: res.data.data.result
                    })
                } else {
                    wx.showToast({
                        title: res.data.message,
                        duration: 2000
                    })
                }

            }
        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})